package com.example.demo.mapper;

import com.example.demo.entity.UserCommonInfo;
import com.example.demo.entity.UserCommonInfoExample;
import java.util.List;

import org.apache.ibatis.annotations.*;

public interface UserCommonInfoMapper {

    //用户管理begin
    @Select("select * from user_common_info where user_id = #{my_id} and user_common_name = #{my_name} and user_common_phone = #{my_phone}")
    UserCommonInfo select_user_common_address_info(@Param("my_id") String my_id, @Param("my_name") String my_name, @Param("my_phone") String my_phone);

    @Delete("delete from user_common_info where user_id = #{my_id} and user_common_name = #{my_name} and user_common_phone = #{my_phone}")
    int delete_user_common_address_info(@Param("my_id") String my_id, @Param("my_name") String my_name, @Param("my_phone") String my_phone);
    //用户管理end

    @Select("select * from user_common_info")
    List<UserCommonInfo> find_all_user_common_info();

    @Select("select * from user_common_info limit 1")
    UserCommonInfo find_last_user_common_info();

    @Select("select * from user_common_info where user_id in (select user_id from user_basic_info where user_phone = #{myphone})")
    List<UserCommonInfo> find_my_user_common_info(@Param("myphone") String myphone);



    @Delete("delete from user_common_info where user_id = #{id} and user_common_phone = #{phone}")
    int delete_my_user_common_info(@Param("id") String _id,@Param("phone") String phone);

    @Update("update user_common_info" +
            "    set user_common_name = #{user_common_name}," +
            "      user_common_address = #{user_common_address}"+
            "    where user_id = #{user_id} and user_common_phone = #{user_common_phone}")
    int update_my_user_common_info(UserCommonInfo userCommonInfo);

    @Insert({ "insert into user_common_info(user_id, user_common_name, user_common_phone, user_common_address)" +
            " values(#{user_id}, #{user_common_name}, #{user_common_phone}, #{user_common_address})" })
    int insert_my_user_common_info(UserCommonInfo userCommonInfo);


    long countByExample(UserCommonInfoExample example);

    int deleteByExample(UserCommonInfoExample example);

    int insert(UserCommonInfo record);

    int insertSelective(UserCommonInfo record);

    List<UserCommonInfo> selectByExample(UserCommonInfoExample example);

    int updateByExampleSelective(@Param("record") UserCommonInfo record, @Param("example") UserCommonInfoExample example);

    int updateByExample(@Param("record") UserCommonInfo record, @Param("example") UserCommonInfoExample example);
}